namespace CISLib
{
    using System;
    using System.Text;

    public class ManageOther
    {
        public static string DecodeWithBytes(string strEncodeValue)
        {
            if (strEncodeValue == string.Empty)
            {
                return strEncodeValue;
            }
            Encoding encoding = new UnicodeEncoding();
            string[] strEncodeAry = strEncodeValue.Split(new char[] { ',' });
            byte[] decodeBytes = new byte[strEncodeAry.Length];
            for (int i = 0; i < strEncodeAry.Length; i++)
            {
                decodeBytes[i] = Convert.ToByte(strEncodeAry[i]);
            }
            return encoding.GetString(decodeBytes);
        }

        public static string EncodeWithBytes(string strValue)
        {
            if (strValue == string.Empty)
            {
                return strValue;
            }
            byte[] encodedBytes = new UnicodeEncoding().GetBytes(strValue);
            string strEncode = string.Empty;
            for (int i = 0; i < encodedBytes.Length; i++)
            {
                string strTmp = encodedBytes[i].ToString();
                strEncode = strEncode + strTmp + ",";
            }
            return strEncode.Substring(0, strEncode.Length - 1);
        }
    }
}

